package by.dkusch.aircompany.services;

import java.util.Set;

import javax.persistence.metamodel.SingularAttribute;

import org.springframework.transaction.annotation.Transactional;

import by.dkusch.aircompany.model.tables.UserAccount;
import by.dkusch.aircompany.model.tables.UserGrant;
import by.dkusch.aircompany.model.tables.UserProfile;

public interface UserService extends AbstractService<Long, UserProfile> {

	@Transactional
	void createNewUser(UserProfile profile, UserAccount account);

	@Transactional
	void updateProfile(UserProfile profile);

	@Transactional
	void removeUser(Long id);

	UserAccount getAccountByEmail(String userName);

	UserAccount getAccountById(Long id);

	UserProfile getByIdWithLazyDetails(Long id);

	Set<UserGrant> getGrants(UserProfile user);

	boolean checkUniqueAccountFields(final SingularAttribute<UserAccount, String> attribute, final String value, final Long id);

}
